package conf

//程序启动之后可变的配置，通过刷 doveclient 更新

import (
	"sync/atomic"
	"time"
)

var larkClientGetTaskTimeout = new(atomic.Value)
var defaultNetReadTimeout = new(atomic.Value)
var defaultNetWriteTimeout = new(atomic.Value)
var defaultNetDialTimeout = new(atomic.Value)
var MaxSizeOfNetPackage uint32

func init() {
	larkClientGetTaskTimeout.Store(time.Second * 20)
}

func LarkClientGetTaskTimeout() time.Duration {
	return larkClientGetTaskTimeout.Load().(time.Duration)
}

var SetDefaultNetReadTimeout = func(d time.Duration) {
	defaultNetReadTimeout.Store(d)
}

var DefaultNetReadTimeout = func() time.Duration {
	return defaultNetReadTimeout.Load().(time.Duration)
}

func SetDefaultNetWriteTimeout(d time.Duration) {
	defaultNetWriteTimeout.Store(d)
}

func DefaultNetWriteTimeout() time.Duration {
	return defaultNetWriteTimeout.Load().(time.Duration)
}

func DefaultNetDialTimeout() time.Duration {
	return defaultNetDialTimeout.Load().(time.Duration)
}

func SetDefaultNetDialTimeout(d time.Duration) {
	defaultNetDialTimeout.Store(d)
}

func DefaultTimeout() time.Duration {
	return time.Second
}
